home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 25 / CU Amiga Magazine's Super CD-ROM 25 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-08].iso / CUCD / Programming / GMS / GMSDev / Includes / files / files.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-22  |  3.9 KB  |  147 lines

  1. #ifndef FILES_FILES_H
  2. #define FILES_FILES_H TRUE
  3.  
  4. /*
  5. **   $VER: files.h V1.0
  6. **
  7. **   File definitions.
  8. **
  9. **   (C) Copyright 1996-1998 DreamWorld Productions.
  10. **       All Rights Reserved.
  11. */
  12.  
  13. #ifndef DPKERNEL_H
  14. #include <dpkernel/dpkernel.h>
  15. #endif
  16.  
  17. /****************************************************************************
  18. ** Module information.
  19. */
  20.  
  21. #define FileModVersion  1
  22. #define FileModRevision 0
  23.  
  24. /****************************************************************************
  25. ** Mini structures for source and destination operations.
  26. */
  27.  
  28. struct Source {      /* Source structure, for internal use only */
  29.   WORD ID;
  30.   APTR Src;
  31. };
  32.  
  33. struct FileName {    /* Filename structure */
  34.   WORD ID;           /* ID_FILENAME */
  35.   BYTE *Name;        /* Pointer to filename */
  36. };
  37.  
  38. struct MemPtr {      /* Memory location structure */
  39.   WORD ID;           /* ID_MEMPTR */
  40.   APTR Address;      /* Pointer to memory area */
  41.   LONG Size;         /* Must supply a size unless you are a MemBlock */
  42. };
  43.  
  44. /****************************************************************************
  45. ** Seek positions.
  46. */
  47.  
  48. #define POS_BEGINNING 0
  49. #define POS_CURRENT   1
  50. #define POS_END       2
  51.  
  52. #define POS_START POS_BEGINNING
  53.  
  54. /****************************************************************************
  55. ** File Object.
  56. */
  57.  
  58. #define VER_FILE  1
  59. #define TAGS_FILE ((ID_SPCTAGS<<16)|ID_FILE)
  60.  
  61. struct File {
  62.   struct Head Head;       /* [00] (-R) Standard structure header */
  63.   LONG   BytePos;         /* [12] (-R) Current position in file */
  64.   LONG   Flags;           /* [16] (IR) File opening flags */
  65.   struct Head *Source;    /* [20] (IR) Direct pointer to the original Source structure */
  66.   struct File *Prev;      /* [24] (-R) Previous file in chain */
  67.   struct File *Next;      /* [28] (-R) Next file in chain */
  68.   APTR   DataProcessor;   /* [32] (--) Not available for program use */
  69.  
  70.   /*** Private fields start now ***/
  71.  
  72.   struct Time *prvDate;
  73.   BYTE   *prvComment;
  74.   LONG   prvSize;
  75.   LONG   prvHandle;
  76.   LONG   prvKey;
  77.   WORD   prvAFlags;
  78.   struct SysObject *prvFileIO;
  79. };
  80.  
  81. /* File tags */
  82.  
  83. #define FLA_Flags   (TLONG|16)
  84. #define FLA_Source  (TAPTR|20)
  85.  
  86. /****************************************************************************
  87. ** Opening flags for Files and Directories.
  88. */
  89.  
  90. #define FL_OLDFILE     0
  91. #define FL_WRITE       (1L<<0)
  92. #define FL_EXCLUSIVE   (1L<<1)
  93. #define FL_DATAPROCESS (1L<<2)
  94. #define FL_FIND        (1L<<3)
  95. #define FL_NOUNPACK    (1L<<4)
  96. #define FL_NOBUFFER    (1L<<5)
  97. #define FL_NEWFILE     (1L<<6)
  98. #define FL_ALPHASORT   (1L<<7)
  99. #define FL_READ        (1L<<8)
  100. #define FL_AUTOCREATE  (1L<<9)
  101.  
  102. #define FL_NOPACK      FL_NOUNPACK
  103.  
  104. /****************************************************************************
  105. ** Permission flags for Files and Directories.
  106. */
  107.  
  108. #define FPT_READ     0x00000001
  109. #define FPT_WRITE    0x00000002
  110. #define FPT_EXECUTE  0x00000004
  111. #define FPT_DELETE   0x00000008
  112. #define FPT_SCRIPT   0x00000010
  113. #define FPT_HIDDEN   0x00000020
  114. #define FPT_ARCHIVE  0x00000040
  115. #define FPT_PASSWORD 0x00000080
  116.  
  117. /****************************************************************************
  118. ** Directory Object.  The format/version of the DirEntry and FileEntry
  119. ** structures is dependent on the directory version.
  120. */
  121.  
  122. #define VER_DIRECTORY  1
  123. #define TAGS_DIRECTORY (ID_SPCTAGS<<16)|ID_DIRECTORY
  124.  
  125. struct Directory {
  126.   struct Head Head;             /* [00] Standard header */
  127.   struct Directory *ChildDir;   /* [12] First directory in list */
  128.   struct File      *ChildFile;  /* [16] First file in list */
  129.   struct FileName  *Source;     /* [20] Location and Name of this directory */
  130.   LONG   Flags;                 /* [24] Opening Flags (see file flags) */
  131.   struct Directory *Next;       /* [28] Next directory in this list */
  132.   struct Directory *Prev;       /* [32] Previous directory in this list */
  133.  
  134.   /*** Private fields ***/
  135.  
  136.   WORD   prvAFlags;
  137.   BYTE   *prvComment;
  138.   struct Time *prvDate;
  139.   struct FileLock *prvLock;
  140. };
  141.  
  142. #define DIRA_Source (TAPTR|20)
  143. #define DIRA_Flags  (TLONG|24)
  144.  
  145. #endif /* FILES_FILES_H */
  146.  
  147.